package com.android.ccarvajal.ejemplos;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class ListaProductos extends ListActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
    	setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, PRODUCTOS));
    	
    	ListView lv = getListView();
    	lv.setTextFilterEnabled(true);
    	lv.setOnItemClickListener(new OnItemClickListener() {
    	    public void onItemClick(AdapterView<?> parent, View view,
    	        int position, long id) {
    	      // When clicked, show a toast with the TextView text
    	      Toast.makeText(getApplicationContext(), ((TextView) view).getText(),
    	          Toast.LENGTH_SHORT).show();
    	    }
    	  });
    	 
    }
    
    static final String[] PRODUCTOS = new String[] {
        "Placas de fíbula distal"
        ,"Clavícula Loc II"
        ,"Placas Humero PHR III"
        ,"Placas Humero PHR III"
        ,"Placas DMR Loc"
        ,"Placas Loc Doble Perfil"
        ,"Fémur CFL"
        ,"Tibia PL Golf LOC"
        ,"Tibia PRL Loc 3.5"
        ,"Tibia MD Loc"
        ,"Tibia ALD Loc"
        ,"Placa T Loc 5.0 mm"
        ,"Placa L Loc 5.0 mm"
        ,"SDC Sistema Dinámico de Cadera"
        ,"SDC Sistema Dinámico Condilar"
        ,"Fémur RP Loc"
      };
}
